
/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background-color: #f5f5dc;
    background-image: url('assets/background2.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #333;
    line-height: 1.6;
}

#game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

#screen {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#screen:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

button {
    background-color: #8b4513;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:hover {
    background-color: #a0522d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input {
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 5px;
}

.event-text {
    font-size: 18px;
    margin-bottom: 20px;
}

.choices {
    margin-top: 20px;
}

.attribute-display {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin: 20px 0;
    flex-wrap: wrap;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 10px;
}

.attribute {
    background-color: #eee;
    padding: 10px;
    border-radius: 5px;
    margin: 5px;
    min-width: 100px;
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: 5px center;
    padding-left: 30px;
    position: relative;
    transition: all 0.3s ease;
}

/* 动画类 */
.attribute.positive {
    animation: positiveChange 0.5s ease;
    background-color: #d4edda;
}

.attribute.negative {
    animation: negativeChange 0.5s ease;
    background-color: #f8d7da;
}

@keyframes positiveChange {
    0% {
        transform: translateY(0);
        background-color: #eee;
    }
    50% {
        transform: translateY(-10px);
        background-color: #d4edda;
        box-shadow: 0 0 10px #28a745;
    }
    100% {
        transform: translateY(0);
        background-color: #d4edda;
    }
}

@keyframes negativeChange {
    0% {
        transform: translateY(0);
        background-color: #eee;
    }
    50% {
        transform: translateY(10px);
        background-color: #f8d7da;
        box-shadow: 0 0 10px #dc3545;
    }
    100% {
        transform: translateY(0);
        background-color: #f8d7da;
    }
}

/* 浮动数字 */
.floating-number {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: bold;
    animation: floatUp 1s ease-out forwards;
    z-index: 10;
    pointer-events: none;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50px);
    }
}

.positive-number {
    color: #28a745;
}

.negative-number {
    color: #dc3545;
}

/* 事件卡片动画 */
.event-card {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 按钮点击动画 */
button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* 年龄增长动画 */
.age-change {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.vitality {
    background-image: url('assets/vitality_icon.png');
}

.strength {
    background-image: url('assets/strength_icon.png');
}

.intelligence {
    background-image: url('assets/intelligence_icon.png');
}

.reputation {
    background-image: url('assets/reputation_icon.png');
}

/* 天劫系统样式 */
.tribulation-screen {
    width: 100%;
    text-align: center;
    background: radial-gradient(circle, #2c0a4d 0%, #0d0620 100%);
    border: 3px solid #8b0000;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
}

/* 天劫背景动画 */
.tribulation-screen::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 0, 0, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 0, 0.1) 0%, transparent 20%);
    animation: celestialPulse 3s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes celestialPulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

.tribulation-screen h2 {
    color: #ff4500;
    font-size: 32px;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.8), 0 0 20px rgba(255, 69, 0, 0.6);
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    0% { text-shadow: 0 0 10px rgba(255, 69, 0, 0.8), 0 0 20px rgba(255, 69, 0, 0.6); }
    100% { text-shadow: 0 0 15px rgba(255, 69, 0, 1), 0 0 30px rgba(255, 69, 0, 0.8), 0 0 45px rgba(255, 69, 0, 0.6); }
}

.tribulation-screen p {
    font-size: 18px;
    margin: 10px 0;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
}

.required-score {
    font-weight: bold;
    color: #ff0000;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    animation: scorePulse 1.5s ease-in-out infinite;
}

@keyframes scorePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.dice-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 30px 0;
    perspective: 1000px;
}

.dice {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, #f0f0f0, #cacaca);
    border: 2px solid #333;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    position: relative;
    transform-style: preserve-3d;
}

.dice:hover {
    transform: translateY(-5px) rotateX(10deg);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    background: linear-gradient(145deg, #ffffff, #e0e0e0);
}

.dice.rolling {
    animation: roll 0.8s ease infinite;
}

@keyframes roll {
    0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(360deg); }
}

/* 成功骰子样式 */
.dice.success {
    background: linear-gradient(145deg, #90ee90, #32cd32);
    border-color: #228b22;
    box-shadow: 0 0 15px rgba(50, 205, 50, 0.7);
}

/* 失败骰子样式 */
.dice.failure {
    background: linear-gradient(145deg, #ff7f7f, #ff2222);
    border-color: #8b0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
}

.dice-info {
    margin: 20px 0;
    font-size: 18px;
    color: #fff;
}

.dice-info p {
    margin: 10px 0;
}

/* 重投次数指示器 */
.reroll-count {
    display: inline-block;
    width: 25px;
    height: 25px;
    background: linear-gradient(145deg, #87ceeb, #4682b4);
    border-radius: 50%;
    line-height: 25px;
    text-align: center;
    font-weight: bold;
    margin: 0 5px;
    box-shadow: 0 0 5px rgba(70, 130, 180, 0.7);
}

.reroll-count.low {
    background: linear-gradient(145deg, #ff7f7f, #ff2222);
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.7);
}

.tribulation-result {
    margin-top: 20px;
    padding: 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    animation: fadeIn 0.5s ease;
    border: 2px solid;
}

.tribulation-result.success {
    background: linear-gradient(145deg, #e8f5e9, #c8e6c9);
    border-color: #4caf50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.tribulation-result.failure {
    background: linear-gradient(145deg, #ffebee, #ffcdd2);
    border-color: #f44336;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.5);
}

.tribulation-result h3 {
    font-size: 28px;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.tribulation-result.success h3 {
    color: #2e7d32;
}

.tribulation-result.failure h3 {
    color: #c62828;
}

.result-animation {
    animation: resultAppear 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes resultAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(50px);
    }
    70% {
        transform: scale(1.05) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 紧张感构建效果 */
.tension-build {
    animation: tensionPulse 2s infinite;
}

@keyframes tensionPulse {
    0% { box-shadow: 0 0 5px rgba(255, 0, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.8); }
    100% { box-shadow: 0 0 5px rgba(255, 0, 0, 0.5); }
}
